webr-demo

Author

Jeffrey M. Perkel

Published

February 23, 2024

WebR

This document demonstrates the webR package for the #rstats community. Using it, in conjunction with the quarto-webr Quarto extension, users can create Quarto documents with code that runs at runtime instead of during document rendering.

This code runs entirely in the browser – no R interpreter is needed, because webR runs the R interpreter in the browser, using WebAssembly.

Among other things, this allows researchers to create tools to explore data. Here we’ll graph the line \[y = mx + b\] By changing the slope and y-intercept, we can illustrate how the line changes.

  1. Click the Run Code button to draw the line y = x.
  2. Adjust the values of b and m on lines 3 and 4 below to specify a new line.
  3. Click Run Code to see how the line changes.